@import '../config';

.drop {
  &-component {
    padding: 10px;
    border: @componentBorder;

    &-active {
      border: @componentActiveBorder;
      background-color: @activeColor;
    }
  }

  &-field {
    // 在 cellControl 中 显示边框
  }

  &-page {
    &-more {
      font-size: 16px;
      color: #aaa;
      height: 100px;
      margin: 20px 0;
      text-align: center;
      padding-top: 30px;
    }
  }
}

.draw {
  &-drag {
    &-component {
      position: relative;
      cursor: pointer;
    }

    &-field {
      position: relative;
      cursor: pointer;
      margin: 5px;

      // 当拖动的时候, 原位置只有一个 div, 并且不是 target
      &-dragging {
        border: @fieldDraggingBorder;
        height: 40px;
      }
    }
  }
}

// dynamic-form
.dynamic-form {
  margin-bottom: 10px;

  &-row {
    display: flex;
    flex-wrap: nowrap;
  }

  //&-col{
  //}
  &-item {
    display: flex;

    line-height: 28px; // todo checkbox switch 的行高不对(修复checkbox, switch)

    // 作为占位的表单组件
    &-placeholder {
      line-height: 28px;
      height: 28px;
    }

    &-label {
      text-align: right;
      line-height: 28px;

      &.required:before {
        display: inline-block;
        margin-right: 4px;
        content: '*';
        line-height: 1;
        font-size: 14px;
        color: #f5222d;
      }
    }

    &-control {
      flex: auto;
      position: relative;
      pointer-events: none;

      :global {
        .ant-input-number,
        .ant-select,
        .ant-calendar-picker {
          width: 100%;
        }
      }
    }
  }

  .cell-control {
    display: flex;
    position: relative;
    min-height: 32px;
    border: 1px solid transparent;

    &:hover,
    &-active {
      background-color: @activeColor;
      border: 1px solid @borderColor;

      .cell-control-remove,
      .cell-control-menu {
        visibility: visible;
      }
    }

    &-placeholder {
      border: 1px dashed #ccc;
      cursor: default;

      &:hover {
        border: 1px dashed @borderColor;
      }
    }

    &-over {
      border: @fieldOverBorder;
      background-color: @activeColor;
    }

    &-component {
      flex: auto;
      padding: 5px 0;
    }

    &-remove {
      visibility: hidden;
      position: relative;
      width: 24px;
      min-width: 24px; // lov 会挤一部分位置

      > i {
        position: absolute;
        top: 50%;
        margin: -6px 6px 0;

        &:before {
          // close 小❌
          content: '\E633';
        }
      }

      &:hover {
        > i:before {
          // close-circle 圈中小❌
          content: '\E62F';
        }
      }
    }

    &-menu {
      visibility: hidden;

      //width: 24px;
      //min-width: 24px; // lov 会挤一部分位置
      > button {
        transition: none;
        height: 100%;
        border-color: transparent;
        background-color: @borderColor;
      }

      :global {
        .ant-dropdown-menu-item {
          position: relative;
          padding-left: 32px;
        }
      }
    }

    &-will-remove {
      // 将要删除的字段的样式
      background-color: #fce4ec;
      border: 1px solid transparent;
      //&-colspan{
      //  background-color: #fce4ec;
      //  border: 1px solid transparent;
      //}
    }
  }

  :global {
    // 表单的 菜单
    .menu-icon {
      width: 16px;
      height: 16px;
      background: url('')
        no-repeat;
      position: absolute;
      top: 8px;
      left: 8px;

      &-append {
        &-row {
          background-position: 0 0;
        }

        &-col {
          background-position: -16px 0;
        }
      }

      &-remove {
        &-row {
          background-position: -80px 0;
        }

        &-col {
          background-position: -96px 0;
        }
      }

      &-merge-right {
        background-position: -48px 0;
      }

      &-cancel-merge-right {
        background-position: 0 0;
      }
    }
  }
}

// dynamic-toolbar
.dynamic-toolbar {
  margin-bottom: 10px;

  .drop-component {
    height: 62px;
    overflow-y: hidden;
    overflow-x: auto;
    white-space: nowrap;
  }

  .draw-drag-field-dragging {
    height: auto;
    min-width: auto;
  }

  &-item {
    display: inline-block;

    div {
      display: inline-block;
    }

    &-control {
      flex: auto;
      position: relative;
      pointer-events: none;
    }

    button {
      min-width: 60px;
    }
  }

  .cell-control {
    //height: 28px;
    border: 1px solid transparent;
    position: relative;

    &:hover,
    &-active {
      background-color: @activeColor;
      border: 1px solid @borderColor;

      .cell-control-remove {
        visibility: visible;
      }
    }

    &-over {
      border: @fieldOverBorder;
      background-color: @activeColor;
    }

    &-remove {
      visibility: hidden;
      height: 28px;
      width: 24px;
      min-width: 24px; // lov 会挤一部分位置
      position: absolute;
      right: 0;
      top: 0;

      > i {
        position: absolute;
        top: 50%;
        margin: -6px 6px 0;

        &:before {
          // close 小❌
          content: '\E633';
        }
      }

      &:hover {
        > i:before {
          // close-circle 圈中小❌
          content: '\E62F';
        }
      }
    }
  }
}

// dynamic-table
.dynamic-table {
  margin-bottom: 10px;

  &-content {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;

    // field
    &-field {
      display: flex;
      position: relative;
      background-color: rgba(0, 0, 0, 0.04) !important;
      color: #333;
      font-weight: bold;
      border: 1px solid #e8e8e8;
      border-bottom: 1.1px solid rgba(0, 0, 0, 0.16);
      word-break: break-word;
    }

    // field-width
    &-field-width {
      // table
      position: relative;
      width: 100%;
      margin-bottom: 4px;
      color: rgba(0, 0, 0, 0.45);

      &-rule-bg {
        position: absolute;
        left: 0;
        bottom: 0;
        height: 10px;
        width: 100%;
        background: url();
        border-bottom: 1px solid #e8e8e8;
      }

      &-wrap {
        // wrap
      }

      &-item {
        height: 36px;
        line-height: 36px;
        list-style: none;

        > span {
          position: relative;

          &:after {
            content: ' ';
            position: absolute;
            right: 0;
            bottom: -6px;
            height: 6px;
            width: 9px;
            display: block;
            background: url();
          }
        }
      }
    }
  }

  &-data {
    border-top-width: 0;
    border-left: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
    padding: 16px;
    background: #fff;
    text-align: center;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
    z-index: 1;
  }

  &-pagination {
    text-align: right;
    margin-top: 10px;
    pointer-events: none;
  }

  .drop-component {
    &-active {
      background-color: inherit;
    }
  }

  &-item {
    display: flex;
    line-height: 28px; // todo checkbox switch 的行高不对(修复checkbox, switch)

    &-control {
      flex: auto;
      position: relative;
      pointer-events: none;
    }
  }

  .cell-control {
    display: flex;
    position: relative;
    color: #333;
    font-weight: bold;
    padding: 14px 8px;
    border: 1px solid #e8e8e8;
    word-break: break-word;

    &:hover,
    &-active {
      background-color: @activeColor;
      border: 1px solid @borderColor;

      .cell-control-remove,
      .cell-control-menu {
        visibility: visible;
      }
    }

    &-over {
      border: @fieldOverBorder;
      background-color: @activeColor;
    }

    &-component {
      flex: auto;
    }

    &-remove {
      visibility: hidden;
      position: relative;
      width: 24px;
      min-width: 24px; // lov 会挤一部分位置

      > i {
        position: absolute;
        top: 50%;
        margin: -6px 6px 0;

        &:before {
          // close 小❌
          content: '\E633';
        }
      }

      &:hover {
        > i:before {
          // close-circle 圈中小❌
          content: '\E62F';
        }
      }
    }
  }
}

// dynamicTabs
.dynamic-tabs {
  margin-bottom: 10px;
  border: @componentBorder;
  padding: 10px;

  &-active {
    border: @componentActiveBorder;
    background-color: @activeColor;
  }

  // TabPane 没有子 tpl
  &-placeholder {
    padding: 20px;
  }

  :global {
    // tabs 对应的样式
    .ant-tabs-bar {
      margin: 0;
    }
  }
  &-field-active {
    :global {
      .ant-tabs.ant-tabs-card > .ant-tabs-bar .ant-tabs-tab-active {
        // 由于 antd-design 是层级嵌套的样式, 所以这边也需要嵌套 以覆盖antd样式
        background-color: @activeColor;
      }
      .ant-tabs-content {
        background-color: @activeColor;
      }
    }
  }
}
